//index.js
//获取应用实例
const app = getApp()

Page({
  data: {
    bannerList: []
  },
  onShareAppMessage: function () {
    return {
      title: '重庆大学体育学院研究生支部委员会',
      path: 'cqdx_communist/pages/index/index'
    }
  },
  onLoad() {
    app.util.request({
      url: 'entry/wxapp/Main',
      success: (res) => {
        console.log(res)
        this.setData({bannerList: res.data.data.banList})
        this.setData({newsList: res.data.data.newsList})
      }
    })
  },
  // onShow() {
  //   wx.hideTabBar();
  // },
  // onHide() {
  //   wx.showTabBar();
  // },
  toActivity() {
    wx.switchTab({
      url: '../activity/activity'
    })
  },
  toDownload() {
    wx.switchTab({
      url: '../download/download'
    })
  },
  toSubmit() {
    wx.switchTab({
      url: '../submit/submit'
    })
  },
  toProposal() {
    wx.switchTab({
      url: '../proposal/proposal'
    })
  },
  handleNewsDetail(e) {
    console.log(e)
    wx.navigateTo({
      url: '../news/news' + '?newsId=' + e.currentTarget.dataset.newsid
    })
  }
})